<template>
  <div class="toast">{{ message }}</div>
</template>
<script>
import { reactive, toRefs } from "vue";
export default {
  name: "ToastPage",
  props: ["message"],
};
export const useToastEffect = () => {
  const ToastData = reactive({
    toastMessage: "",
    show: false,
  });
  const ToastShow = (message) => {
    ToastData.show = true;
    ToastData.toastMessage = message;
    setTimeout(() => {
      ToastData.show = false;
      ToastData.toastMessage = "";
    }, 2000);
  };
  const { toastMessage, show } = toRefs(ToastData);
  return { ToastShow, toastMessage, show };
};
</script>
<style lang="scss" scoped>
@import "../../style/viriables.scss";
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.1rem;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 0.05rem;
  color: $color-fff;
}
</style>